package org.zhadoop.stream.cql.semanticanalyzer.parser.context;

import java.util.Locale;

import org.zhadoop.stream.cql.exception.SemanticAnalyzerException;
import org.zhadoop.stream.cql.semanticanalyzer.analyzecontext.expressiondesc.ExpressionDescribe;
import org.zhadoop.stream.cql.semanticanalyzer.parsecontextreplacer.ParseContextReplacer;
import org.zhadoop.stream.cql.semanticanalyzer.parsecontextwalker.ParseContextWalker;

/**
 * like 表达式解析内容
 * 
 * @author zwd
 *
 */
public class ExpressionLikeContext extends BaseExpressionParseContext {

	private boolean isNotLike = false;

	private String likeOperator;

	private BaseExpressionParseContext likeExpression;

	public boolean isNotLike() {
		return isNotLike;
	}

	public void setNotLike(boolean isNotLike) {
		this.isNotLike = isNotLike;
	}

	public String getLikeOperator() {
		return likeOperator;
	}

	public void setLikeOperator(String likeOperator) {
		this.likeOperator = likeOperator;
	}

	public BaseExpressionParseContext getLikeExpression() {
		return likeExpression;
	}

	public void setLikeExpression(BaseExpressionParseContext likeExpression) {
		this.likeExpression = likeExpression;
	}

	@Override
	public void walkChildAndReplace(ParseContextReplacer replacer) {
		// TODO Auto-generated method stub

	}

	@Override
	protected ExpressionDescribe createExpressionDesc() throws SemanticAnalyzerException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		if (isNotLike) {
			sb.append("NOT ");
		}
		sb.append(likeOperator.toUpperCase(Locale.US) + " ");
		sb.append(likeExpression.toString());
		return sb.toString();
	}

	@Override
	protected void walkChild(ParseContextWalker walker) {
		// TODO Auto-generated method stub

	}

}
